package com.bifrost.service;

import com.bifrost.entity.*;
import com.bifrost.model.orderreturn.ReturnModel;
import com.bifrost.model.orderreturn.ReturnRequest;

import java.util.List;

/**
 * @author rangf
 * @date 2018/3/6
 */
public interface ReturnService {

    /**
     * 订单是否可以申请售后
     *
     * @param order
     * @return
     */
    public boolean canReturn(Order order);

    /**
     * 申请售后(單品)
     *
     * @param customer customer
     * @param order    order
     * @param orderItem     orderItem
     * @param request  request
     * @return 订单
     */
    public OrderReturn apply(Customer customer, Order order, OrderItem orderItem, ReturnRequest request);
    /**
     * 申请售后(整单)
     *
     * @param customer customer
     * @param order    order
     * @param request  request
     * @return 订单
     */
    public OrderReturn applyAll(Customer customer, Order order, ReturnRequest request);

    /**
     * 申请售后:保存订单项
     *
     * @param orderReturn orderReturn
     * @param item  item
     * @param isSingleReturn 是否单品退货
     * @return 订单
     */
    public OrderReturn saveOrderReturnItem(OrderReturn orderReturn, OrderItem item, boolean isSingleReturn);

    /**
     * 撤销售后
     *
     * @param customer customer
     * @param returnId  售后单Id
     * @return
     */
    public boolean cancel(Customer customer, Long returnId);

    /**
     * 售后：邮寄商品
     *
     * @param customer   customer
     * @param returnId    returnId
     * @param shipNumber shipNumber
     * @return
     */
    public boolean deliver(Customer customer, Long returnId, String shipNumber);

    /**
     * 获取所有售后单
     *
     * @param merchantStore
     * @param page
     * @param pageSize
     * @param customer
     * @param status
     * @return
     */
    public List<ReturnModel> orders(MerchantStore merchantStore, Integer page, Integer pageSize, Customer customer, String status);

    /**
     * 获取退货单明细
     *
     * @param returnId returnId
     * @return
     */
    public ReturnModel order(Long returnId);

    /**
     * 查询所有有效售后
     *
     * @param orderId
     * @return
     */
    List<OrderReturn> findVaildRefundOrders(Long orderId);

    /**
     * 返回实体
     *
     * @param returnId
     * @return
     */
    OrderReturn findById(Long returnId);

    //Map buildBonusponitsMsgMapByReturnOrder(Long returnId);

}
